' 
' Copyright (C) 2014 Infinity CCS Ltd (http://www.infinityccs.com/)
' Copyright (C) 2008 Sasa Coh <sasacoh@gmail.com>
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program.  If not, see <http://www.gnu.org/licenses/>. 
'/

Imports System.Runtime.InteropServices
Imports System
Imports System.Text
Imports Infinity.pjsipNET.Common

Public Class pjsipWrapper
  <DllImport("Infinity.pjsip.dll", EntryPoint:="dll_getErrorString", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl)>
  Private Shared Sub dll_getErrorString(errorId As Integer, buffer As StringBuilder, bufferSize As Integer)
  End Sub

  Public Shared Function getErrorString(errorId As Integer) As String
    Select Case errorId
      Case 130048
        Return "Cannot create transport: maybe the port is busy!"
      Case Else
        Dim sb As New StringBuilder(80)
        dll_getErrorString(120005, sb, sb.Capacity)
        Return sb.ToString
    End Select
  End Function
End Class
